package com.chuang.bootplus.controller.sms;


import com.chuang.bootplus.base.utils.ApiResponse;
import com.chuang.bootplus.entity.Sms;
import com.chuang.bootplus.po.SmsCheckPO;
import com.chuang.bootplus.service.SmsService;
import com.chuang.bootplus.vo.SmsCheckVO;
import com.chuang.bootplus.vo.SmsVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;

import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sms")
@Api(tags = {"用户信息"})
@CrossOrigin
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SmsController {

    private final SmsService smsService;

    @PostMapping("sendCode")
    @ApiOperation(httpMethod = "POST", value = "发送验证码")
    @ApiOperationSupport(includeParameters = {"Sms.phone,Sms.code,Sms.min"})
    public ApiResponse<SmsVO> SmsCode(@RequestBody Sms sms){
       return smsService.smsCode(sms);
    }

    @PostMapping("checkCode")
    @ApiOperation(httpMethod = "POST", value = "验证验证码")
    @ApiOperationSupport(includeParameters = {"Sms.phone,Sms.code"})
    public ApiResponse<SmsCheckVO> SmsCheck(@RequestBody SmsCheckPO smsCheckPO){
       return smsService.smsCheck(smsCheckPO);
    }


}
